package com.yanqu.road.entity.monopolymarket.group;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.ArrayList;
import java.util.List;

/**
 * 1.后台通知跨服分组变动  跨服检查每一个分组是否发生变动 如果变成修改分组或者新增分组 时间置成当前时间
 * 2.跨服重启，检查改表的每个分组是否与后台表是否一致，如果不一致，修改分组或者新增分组  时间置成当前时间
 * 3.
 *
 * @Description 每个榷场分组、区服 分组信息
 * @Author cwq
 * @Data 2021/8/11 18:06
 */
@FieldTypeAnnotation(tableName = "t_c_monopolymarket_cross_group")
public class MonopolyMarketCrossGroup extends DataObject implements IMonopolyMarketGroup {
    @FieldTypeAnnotation(select = true, update = true)
    private int channelId;
    @FieldTypeAnnotation(select = true, update = true,desc = "分组id")
    private long groupId;
    @FieldTypeAnnotation(desc = "区服")
    private List<Long> serverList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "状态，0关闭 1开启 ")
    private int state;
    @FieldTypeAnnotation(desc = "边关要塞是否开启 (0关闭 1开启)")
    private int fortressState;
    @FieldTypeAnnotation(desc = "榷署上次刷新时间")
    private int officeRefreshTime;
    @FieldTypeAnnotation(desc = "王宫上次刷新时间")
    private int kingResGrabRefreshTime;
    @FieldTypeAnnotation(desc = "王帐上次刷新时间")
    private int queenResGrabRefreshTime;
    @FieldTypeAnnotation(desc = "要塞上次刷新时间")
    private int fortressRefreshTime;
    @FieldTypeAnnotation(desc = "最后一次修改分组区服的时间")
    private int changTime;
    @FieldTypeAnnotation(desc = "最后一次修改榷署配置的时间")
    private int officeCfgChangTime;
    @FieldTypeAnnotation(desc = "最后一次修改王帐配置的时间")
    private int kingCfgChangTime;
    @FieldTypeAnnotation(desc = "最后一次修改王宫配置的时间")
    private int queenCfgChangTime;

    public int getChannelId() {
        return channelId;
    }
    public void setChannelId(int channelId) {
        if (this.channelId != channelId) {
            this.channelId = channelId;
            setOp(DataStatus.Update);
        }
    }

    public long getGroupId() {
        return groupId;
    }
    public void setGroupId(long groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public java.util.List<java.lang.Long> getServerList() {
        return serverList;
    }
    public void setServerList(java.util.List<java.lang.Long> serverList) {
        if (null == serverList){
            return;
        }
        if (this.serverList == null || !this.serverList.equals(serverList)) {
            this.serverList = serverList;
            setOp(DataStatus.Update);
        }
    }

    public int getState() {
        return state;
    }
    public void setState(int state) {
        if (this.state != state) {
            this.state = state;
            setOp(DataStatus.Update);
        }
    }

    public int getFortressState() {
        // TODO 4.0版本 默认关闭
        return 0;
    }

    public void setFortressState(int fortressState) {
        if (this.fortressState != fortressState) {
            this.fortressState = fortressState;
            setOp(DataStatus.Update);
        }
    }

    public int getOfficeRefreshTime() {
        return officeRefreshTime;
    }

    public void setOfficeRefreshTime(int officeRefreshTime) {
        if (this.officeRefreshTime != officeRefreshTime) {
            this.officeRefreshTime = officeRefreshTime;
            setOp(DataStatus.Update);
        }
    }

    public int getChangTime() {
        return changTime;
    }
    public void setChangTime(int changTime) {
        if (this.changTime != changTime) {
            this.changTime = changTime;
            setOp(DataStatus.Update);
        }
    }

    public int getOfficeCfgChangTime() {
        return officeCfgChangTime;
    }
    public void setOfficeCfgChangTime(int officeCfgChangTime) {
        if (this.officeCfgChangTime != officeCfgChangTime) {
            this.officeCfgChangTime = officeCfgChangTime;
            setOp(DataStatus.Update);
        }
    }

    public int getKingCfgChangTime() {
        return kingCfgChangTime;
    }
    public void setKingCfgChangTime(int kingCfgChangTime) {
        if (this.kingCfgChangTime != kingCfgChangTime) {
            this.kingCfgChangTime = kingCfgChangTime;
            setOp(DataStatus.Update);
        }
    }

    public int getQueenCfgChangTime() {
        return queenCfgChangTime;
    }
    public void setQueenCfgChangTime(int queenCfgChangTime) {
        if (this.queenCfgChangTime != queenCfgChangTime) {
            this.queenCfgChangTime = queenCfgChangTime;
            setOp(DataStatus.Update);
        }
    }

    public int getKingResGrabRefreshTime() {
        return kingResGrabRefreshTime;
    }

    public void setKingResGrabRefreshTime(int kingResGrabRefreshTime) {
        if (this.kingResGrabRefreshTime != kingResGrabRefreshTime) {
            this.kingResGrabRefreshTime = kingResGrabRefreshTime;
            setOp(DataStatus.Update);
        }
    }

    public int getQueenResGrabRefreshTime() {
        return queenResGrabRefreshTime;
    }

    public void setQueenResGrabRefreshTime(int queenResGrabRefreshTime) {
        if (this.queenResGrabRefreshTime != queenResGrabRefreshTime) {
            this.queenResGrabRefreshTime = queenResGrabRefreshTime;
            setOp(DataStatus.Update);
        }
    }

    public int getFortressRefreshTime() {
        return fortressRefreshTime;
    }

    public void setFortressRefreshTime(int fortressRefreshTime) {
        if (this.fortressRefreshTime != fortressRefreshTime) {
            this.fortressRefreshTime = fortressRefreshTime;
            setOp(DataStatus.Update);
        }
    }


    @Override
    public long getMonopolyMarketGroupId() {
        return this.groupId;
    }

    @Override
    public List<Long> getMonopolyMarketServerList() {
        return this.serverList;
    }

    @Override
    public int getMonopolyMarketChangeTime() {
        return this.getChangTime();
    }

    @Override
    public int getMonopolyMarketFortressState() {
        return this.getFortressState();
    }
}
